From: Florian Müllner Date: Sat, 30 Jul 2022 00:24:17 +0000 (+0200) Subject: panel: Add closeQuickSettings() method X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~461^2^2~188 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7834372acbaad177c6f0649fa9f328186e22b8eb;p=gnome-shell.git panel: Add closeQuickSettings() method Like the aggregate menu currently, the quick settings menu will eventually contain some items that should dismiss the menu. And as those items may appear in child menus or otherwise be nested, a public method on a global object is more convenient than handing the main menu down the hierarchy. Part-of: --- diff --git a/js/ui/panel.js b/js/ui/panel.js index 850d4f06c..d259fcbb2 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -643,6 +643,16 @@ class Panel extends St.Widget { menu.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); } + _closeMenu(indicator) { + if (!indicator || !indicator.mapped) + return; // menu not supported by current session mode + + if (!indicator.reactive) + return; + + indicator.menu.close(); + } + toggleAppMenu() { this._toggleMenu(this.statusArea.appMenu); } @@ -652,15 +662,11 @@ class Panel extends St.Widget { } closeCalendar() { - let indicator = this.statusArea.dateMenu; - if (!indicator) // calendar not supported by current session mode - return; - - let menu = indicator.menu; - if (!indicator.reactive) - return; + this._closeMenu(this.statusArea.dateMenu); + } - menu.close(); + closeQuickSettings() { + this._closeMenu(this.statusArea.quickSettings); } set boxOpacity(value) {